package algorithm.leetcode.q35;

/**
 * 搜索插入位置
 * @author lsw
 * 2020-9-3 23:30:26
 */


public class Solution {
    public int searchInsert(int[] nums, int target) {
        for(int i=0;i<nums.length;i++){
            if(nums[i]<target&&i==nums.length-1){
                return i+1;
            }
            if(nums[i]<target&&nums[i+1]>=target){
                return i+1;
            }
           
        }
        return 0;
    }
}